package com.feicheng;

import com.baomidou.mybatisplus.extension.api.R;

import java.io.IOException;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.attribute.FileTime;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

public class Temp {

    public static void main(String[] args) {
        Path directory = Paths.get("E:\\tt"); // 替换为你的目录路径
        Random random = new Random();

        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");







        try {
            Files.walkFileTree(directory, new SimpleFileVisitor<Path>() {
                @Override
                public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {

                    long tempstamp = new Date().getTime();
                    int hh = 60;
                    int mm = random.nextInt(55)+45;
                    long x = 1000 * hh * mm;
                    int r = random.nextInt(5)+3;
                    long y = r * x;

                    long k = tempstamp - y;



                    Files.setLastModifiedTime(file, FileTime.fromMillis(k));
                    return FileVisitResult.CONTINUE;
                }
            });
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
